<template>
    <div class="news" >
        <div class="top">
            <div class="newLeft">
                <p>{{ one.title }}</p>
                <span>{{ one.desc }}</span>
            </div>
            <div class="newRight" ref="newRight">{{ one.right }}</div>
        </div>
        <ul class="foot">
            <li v-for="item in auto" :key="item.id">
                <img :src="item.picture">
                <div class="footBox" :style="{ background: one.bj }">
                    <h3>{{ item.desc }}</h3>
                    <span :style="{ color: one.color }"><span>{{ one.q }}</span> {{ item.price }}</span>
                </div>
            </li>
        </ul>
    </div>
</template>

<script>

export default {
    props: {
        auto: {
            type: Array
        },
        one: {
            type: Object
        }
    },
    methods: {

    },
    mounted() {
        this.$refs.newRight.addEventListener('click', () => {
            document.documentElement.scrollTop=0
        })

       
    }

}
</script>



<style lang="scss" scoped>
@import '@/assets/css/variables.scss';

.news {
    width: 1240px;
    height: 541px;
    background: white;
    margin: auto;
    display: flex;
    flex-direction: column;

    .top {
        width: 100%;
        height: 35px;
        margin-top: 40px;
        margin-bottom: 40px;
        // background: orange;
        display: flex;
        justify-content: space-between;
        align-items: center;

        .newLeft {
            width: 300px;
            height: 100%;
            // background: yellow;
            display: flex;
            justify-content: space-between;
            align-items: center;

            p {
                font-size: 32px;
                text-align: center;
            }

            span {
                color: grey;
            }
        }

        .newRight {
            color: grey;
        }

        .newRight:hover {
            color: $xtxColor;
        }
    }

    .foot {
        width: 100%;
        height: 406px;
        display: flex;
        justify-content: space-between;
        // background: yellow;


        li {
            width: 306px;
            height: 100%;
            display: flex;
            flex-direction: column;

            // background: orange;
            img {
                width: 306px;
                height: 306px;
                // background: purple;
            }

            .footBox {
                flex: 1;
                display: flex;
                flex-direction: column;

                h3 {
                    flex: 1;
                    // background: yellowgreen;
                    text-align: center;
                    line-height: 50px;
                    text-overflow: ellipsis;
                    overflow: hidden;
                    white-space: nowrap
                }

                span {
                    flex: 1;
                    // background: paleturquoise;
                    text-align: center;
                    line-height: 50px;
                    font-size: 22px;
                }
            }
        }

        li:hover {
            transform: translateY(-5px);
            transition: all .3s;
            box-shadow: 0 0 5px gray;

        }
    }
}
</style>